<link rel="shortcut icon" href="<?php echo base_url() ?>static/images/logoTelkomsel-favico.png" />
<link href="<?php echo base_url() ?>static/css/bootstrap.css" rel="stylesheet"/>
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>static/css/main.css" />
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>static/select2/select2.css" />
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>static/select2/select2-bootstrap.css" />
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>static/css/jquery.datetimepicker.css"/>
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>static/js/Metro-UI-CSS/min/iconFont.min.css"/>
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>static/css/print.css" />
<script type="text/javascript" src="<?php echo base_url(); ?>static/js/jquery-excel-export/jquery.btechco.excelexport.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>static/js/jquery-excel-export/jquery.base64.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>static/js/jquery.printElement.min.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>static/js/bootstrap.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>static/js/jquery.datetimepicker.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>static/js/jquery.validate.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>static/js/form.js"></script>

<script type="text/javascript" src="<?php echo base_url(); ?>static/select2/select2.min.js" ></script>
<script type="text/javascript" src="<?php echo base_url(); ?>static/js/selectSearchGlobal.js"></script>
<script>
    $("#r_venname").change(function() //b=0,b=1,b=2
        {   
            var venid = $(this).val();
        	var DataString = {id:venid};
            var idName=this.id.substr(9); //nilai ini penting bro, buat ngambil nama dari ID 
            	$.ajax({
            			type: "POST",
            			url : "<?php echo site_url('search_global/globals_ven_detail')?>",
            			dataType: 'json',
            			data: DataString,
            			success: function(data)
            			{
            				$("#r_venid").val(data.DetailVen.VENDOR_ID); //b=3,b=3,b=3
                            $("#r_vennama").val(data.DetailVen.VENDOR_NAME);//b=1,b=2,b=3
            				$("#r_venpic").val(data.DetailVen.PIC);			
            			}
            			
            		});
        });
    function editSrnKrjOvtBawahEditSave() { 
        arrNama=document.getElementById('pSodName').value;
        arrLantai=document.getElementById('pSodFloor').value;
        arrLocation=document.getElementById('pSodLocation').value;
        arrVendorId=document.getElementById('r_venid').value;
        
        $.post("<?= site_url() ?>search_globalA/edit_ovtBawahEditSave", {
            pCType          : $('#pCType').val(),
            pSoId          : $('#pCtrlID').val(),
            pSodId          : arrVendorId,
            //UNTUK PILIHAN TABEL BAWAH
            //pSikIdBawah     : arrId,
            pSodName        : arrNama,
            pSodLantai      : arrLantai,
            pSodLocation    : arrLocation,
            pSodVendorId    : arrVendorId    
        }/*,
            function(data) {
                $.post("<?= site_url() ?>search_global/edit_req", {
                    cRequestNo : $('#pCtrlID').val(),
                    cType : $('#pCType').val(),
                    cTab : "saranaKerja"
                },
                function(data) {
                    $('#top').html(data); //Tampilkan di id TOP yang ada di Induk Search Global, redirect ke id top di halaman ke-2
                });
            }*/
        );
        
        
    }
    function back() { 
        $.post("<?= site_url() ?>search_global/edit_req", {
            cRequestNo : $('#pCtrlID').val(),
            cType : $('#pCType').val(),
            cTab : "saranaKerja"
        },
        function(data) {
            $('#top').html(data); //Tampilkan di id TOP yang ada di Induk Search Global, redirect ke id top di halaman ke-2
        });
    }
</script>


<form id="formarea" role="form" method="post" action="#">
<input type="hidden" value="<?php echo $cRequestNo; ?>" id="pCtrlID" />
<input type="hidden" value="<?php echo $cType; ?>" id="pCType" />
<input type="hidden" value="<?php echo $cSikjId; ?>" id="pSikjId" />

<?php
foreach($getDetailBawah as $b){
    $bSodId   		= $b["SOD_ID"];
    $bSodName   	= $b["SOD_NAME"];
    $bSodFloor   	= $b["SOD_FLOOR"];
    $bSodLocation   = $b["SOD_LOCATION"];
    $bSodVendorId   = $b["SOD_VENDOR_ID"];
    $bSodVendorName = $b["SOD_VENDOR_NAME"];
    $bSoId   		= $b["SO_ID"];
?>
<div class="panel panel-primary">
    <div class="panel-heading">
    <h4 class="panel-title"><b class="caret"></b><b> Request</b></h4>
    </div>
    <div class="panel-body">

        <div class="row"> 
            <div class="col-sm-12">
                <div class="form-group">
                    <label class="control-label col-md-3">Name</label>
                    <div class="col-md-3">                
                        <input type="text" id="pSodName" class="form-control input-sm" value="<?php echo $bSodName;?>"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="row"> 
            <div class="col-sm-12">
                <div class="form-group">
                    <label class="control-label col-md-3">Floor</label>
                    <div class="col-md-3">
                        <select id="pSodFloor" class="form-control input-sm">
                            <?php 
                            foreach ($getLantai as $v){ 
                                $lt=$v['MST_FLOOR_DESC'];?>
                                    <option value="<?php echo $lt; ?>" <?php if($bSodFloor==$lt){?>selected=""<?php } ?>> <?php echo $lt;?></option>
                             <?php
                             }?>
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div class="row"> 
            <div class="col-sm-12">
                <div class="form-group">
                    <label class="control-label col-md-3">Location</label>
                    <div class="col-md-3">  
                        <input type="text" id="pSodLocation" class="form-control input-sm" value="<?php echo $bSodLocation;?>"/>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="row"> 
            <div class="col-sm-12">
                <div class="form-group">
                    <label class="control-label col-md-3">Vendor</label>
                    <div class="col-md-3">  
                        <input type="text" id="r_venid" value="<?php echo $bSodVendorId;?>" readonly="" class="form-control input-sm"/>
    					<div >
                            <input type="hidden" id="r_vennama" value="<?php echo $bSodVendorName;?>" class="form-control input-sm" readonly=""/>
                        </div>
                        <div >
                            <input type="text" id="r_venname" placeholder="<?php echo $bSodVendorName;?>" class="select2 form-control input-sm"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="row"> 
            <div class="col-sm-12">
                <div class="form-group">
                    <div class="col-md-3">  
                        <button type="button" class="btn btn-success btn-block" onclick="editSrnKrjOvtBawahEditSave();" >Edit Now</button>
                    </div>
                    <div class="col-md-3">  
                        <button type="button" class="btn btn-default btn-block" onclick="back();" >Cancel</button>
                    </div>                    
                </div>
            </div>
        </div>


    </div>
</div>

<?php
}
?>
</form>